package com.yakuj3.android.comptadroid.data;

import android.graphics.Color;

public class Operation {

	private long id;
	private String month; 
	private String libele;
	private float montant;
	
	private static final String RED = "#FF0000";
	private static final String GREEN = "#008000";
	
	public Operation(long id, String month, String libele, float montant)
	{
		super();
		this.id = id;
		this.month = month;
		this.libele = libele;
		this.montant = montant;
	}
	
	public void setLibele(String l)
	{
		this.libele = l;
	}
	
	public void setMontant(float m)
	{
		this.montant = m;
	}
	
	public int getDisplayColor()
	{
		if (montant < 0)
			return Color.parseColor(RED);
		else
			return Color.parseColor(GREEN);
	}
	
	public String getMontant()
	{
		return "" + montant + " euros";
	}
	
	public String getLibele()
	{
		return libele;
	}
	
	public float getMontantAsInteger()
	{
		return montant;
	}
	
	public boolean getType()
	{
		return montant < 0 ? false: true;
	}
	
	public void updateOperation(String l, String m)
	{
		this.libele = l;
		this.montant = Float.parseFloat(m);			
	}

	public String getMonth() {
		return month;
	}

	public void setMonth(String month) {
		this.month = month;
	}

	public long getId() {
		return id;
	}

	public void setId(long id) {
		this.id = id;
	}
}
